//
//  MYGHealthManagementStatisticsModel.swift
//  MYGrow
//
//  Created by 林矗 on 2024/3/9.
//

import UIKit

class MYGHealthManagementStatisticsModel: MYGHealthManagementRowModel {
    var statisticsType: MYGHealthStatisticsType
    var target: NSObject?
    var selector: Selector?
    override var action: (() -> ())? {
        return {
//            let vc = MYGHealthStastiscViewController()
//            vc.statisticsType = self.statisticsType
//            UIViewController.currentViewController?.navigationController?.pushViewController(vc)
//            MYGHealthManager.shareManager.showRecordView(with: self.statisticsType) { success in
//                if success {
//                    guard let target = self.target, let selector = self.selector else { return }
//                    target.perform(selector)
//                }
//            }
        }
    }
    
    var title: String {
        switch statisticsType {
        case .pressure:
            "血压信息 mmHg"
        case .sugar:
            "血糖信息 mmol/L"
        case .heart:
            "心率信息 次/分"
        case .bmi:
            "BMI信息"
        }
    }
    
    var icon: String {
        "\(statisticsType.rawValue)_icon"
    }
    
    var bgImageName: String {
        "\(statisticsType.rawValue)_bg"
    }
        
    var themeColor: UIColor {
        switch statisticsType {
        case .pressure:
            UIColor.rgba(132, 97, 201)
        case .sugar:
            UIColor.rgba(227, 163, 61)
        case .heart:
            UIColor.rgba(246, 49, 59)
        case .bmi:
            UIColor.rgba(6, 160, 173)
        }
    }
    
    var key1: String {
        switch statisticsType {
        case .pressure:
            "收缩压/高压"
        case .sugar:
            "空腹"
        case .heart:
            "心率值"
        case .bmi:
            "BMI值"
        }
    }
    
    var value1: String?
    
    var key2: String {
        switch statisticsType {
        case .pressure:
            "收缩压/低压"
        case .sugar:
            "餐后两小时"
        case .heart:
            ""
        case .bmi:
            ""
        }
    }
    
    var value2: String?
    
    
    init(statisticsType: MYGHealthStatisticsType, value1: String? = nil, value2: String? = nil, target: NSObject? = nil, selector: Selector?) {
        self.statisticsType = statisticsType
        self.value1 = value1
        self.value2 = value2
        self.target = target
        self.selector = selector
        super.init(type: .statistics)
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
}
